<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
 <?php
    echo $this->Html->css(array('nivo-default','nivo-slider'));
    echo $this->Html->script(array('jquery.nivo.slider','jquery.tinyscrollbar.min','bs'));
?>
<script>
//    $(document).ready(function(){
//     $('#scrollbar1').tinyscrollbar();
//     $('#scrollbar2').tinyscrollbar();
// });
</script>
<script>
$(document).ready(function() {
    $('#myCarousel').carousel({
    interval: 10000
    });
    $('#featurepr').carousel({
    interval: 10000
    });
});
</script>
<style>
    .carousel {
    margin-bottom: 0;
    padding: 0 40px;
}

.carousel-control {
    left: -12px;
}
.carousel-control.right {
    right: -12px;
}

.carousel-indicators {
    right: 50%;
    top: auto;
    bottom: 0px;
    margin-right: -19px;
}

.carousel-indicators li {
    background: #c0c0c0;
}

.carousel-indicators .active {
background: #333333;
}
#featurepr ul li{ float:  left;width:20%;}
.carousel-control{top: 50%;}
</style>
<div id="zt-colright" class="span9">
    <!-- SLIDE -->
    <div class="visible-desktop">
        <div class="custom-color">
             <div class="slider-wrapper theme-default">
                <div id="slider" class="nivoSlider">
                    <?php foreach ($hSlide as $key => $value) {?>
                    <?php echo $this->Html->image('../files/uploads/slides/'.$value['Slide']['url'],array('alt'=>"" ,"title"=>"#htmlcaption".$key));?>
                    <?php }?>
                </div>

                    <?php foreach ($hSlide as $key => $value) {?>
                     <div id="htmlcaption<?php echo $key;?>" class="nivo-html-caption">
                        <a href='<?php echo $value["Slide"]["link"];?>'>
                            <?php echo $value['Slide']['note'];?>
                        </a>
                        <div>
                            <?php echo $value['Slide']['desc'];?>
                        </div>
                        </div>
                    <?php }?>

            </div>
            <script type="text/javascript">
                $(window).load(function() {
                     $('#slider').nivoSlider({
                        effect: 'random',               // Specify sets like: 'fold,fade,sliceDown'
                        slices: 15,                     // For slice animations
                        boxCols: 8,                     // For box animations
                        boxRows: 4,                     // For box animations
                        animSpeed: 500,                 // Slide transition speed
                        pauseTime: 3000,                // How long each slide will show
                        startSlide: 0,                  // Set starting Slide (0 index)
                        directionNav: true,             // Next & Prev navigation
                        controlNav: false,               // 1,2,3... navigation
                        controlNavThumbs: true,        // Use thumbnails for Control Nav
                        pauseOnHover: true,             // Stop animation while hovering
                        manualAdvance: false,           // Force manual transitions
                        prevText: 'Prev',               // Prev directionNav text
                        nextText: 'Next',               // Next directionNav text
                        randomStart: false,             // Start on a random slide
                        beforeChange: function(){},     // Triggers before a slide transition
                        afterChange: function(){},      // Triggers after a slide transition
                        slideshowEnd: function(){},     // Triggers after all slides have been shown
                        lastSlide: function(){},        // Triggers when last slide is shown
                        afterLoad: function(){}         // Triggers when slider has loaded
                    });
                    $('.bslink').bstip();
                });
                </script>
        </div>
    </div>
    <div class="visible-desktop">
    <div class="custom-color">
        <!--quang cao -->
        <div id="zt-modwrap">
            <div class="zt-modwrap-pad">
                <div id="zt-colleft" class="span12">
                    <div class="well">
                        <div id="featurepr" class="carousel slide">
                        <!-- Carousel items -->
                        <div class="carousel-inner">
                         <?php
                             if (count($hgalleries)%5==0) {
                                 $n= count($hgalleries)/5;
                             }else $n = count($hgalleries)/5 +1;
                             if(count($hgalleries) <=5) $n=2;

                             for($i=0;$i<$n-1;$i++){

                                $arr = array_slice($hgalleries, ($i*5),5,true);
                                ?>
                                <div <?php if($i==0){?>class="item active"<?php }else{?> class="item"<?php }?>>
                                    <div class="row-fluid">
                                        <ul>
                                        <?php foreach ($arr as $key => $value) {?>
                                        <li>

                                            <?php
                                            echo $this->Html->link(
                                                 $this->Html->image('../files/uploads/gallery/'.$value['Gallery']['url'],array("border"=>"0",'alt'=>$value['Gallery']['name'],'width'=>'125px','height'=>'100px')),
                                                 array('plugin'=>false,'language'=>$lang,'controller'=>"galleries","action"=>'chitiet',$this->Link->seo($value['Gallery']['id'],$value['Gallery']['name'])),
                                                 array('class'=>'bslink','title'=>$value['Gallery']['name'],'escape'=>false)
                                            );?>

                                        </li>
                                      <?php }//endfor?>
                                  </ul>
                                    </div><!--/row-fluid-->
                                </div><!--/item-->
                            <?php
                            }
                         ?>
                        </div><!--/carousel-inner-->

                        <a class="left carousel-control" href="#featurepr" data-slide="prev">‹</a>
                        <a class="right carousel-control" href="#featurepr" data-slide="next">›</a>
                        </div><!--/myCarousel-->
                    </div><!--/well-->
                </div>
            </div>
        </div>
    </div>
    </div>
    <!-- không có thẻ đóng -->
    <!-- DỊCH VỤ - SẢN PHẨM -->
    <div id="zt-colleft-pad">
        <div id="zt-contentwrap" class="row-fluid">
            <div class="span12">
                <div class="module-color zt-mod-br">
                    <div class="zt-mod-bl">
                        <div class="zt-mod-tr">
                            <div class="zt-mod-tl clearfix">
                                <h3><span>
                                    <?php echo $this->Html->link(
                                           __('headerService',true),
                                            array('plugin'=>false,'language'=>$lang,'controller'=>"services","action"=>'index')
                                    );?>
                                </span></h3>
                                <div class="mod-content">
                                    <div id="scrollbar12" class='scolls12'>
                                        <!-- <div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div> -->
                                        <!-- <div class="viewport">
                                            <div class="overview span12"> -->
                                                <div class="row-fluid blocksv">
                                                <?php foreach ($hService as $key => $value) {?>
                                                    <div class="latestnews span3 services">
                                                        <div class="latestnewsitems" style="width:100%">
                                                            <div class="latestnewsitems-inner">
                                                                <div class='titleservice'>
                                                                    <?php echo $this->Html->link(
                                                                        $value['Cateservice']['name'],
                                                                        array('plugin'=>false,'language'=>$lang,'controller'=>"services","action"=>'index',$this->Link->seo($value['Cateservice']['id'],$value['Cateservice']['name'])),
                                                                        array('class'=>'latestnews','escape'=>false)
                                                                    );?>

                                                                </div>

                                                                 <?php //if(is_file('files/uploads/services/'.$value['Cateservice']['anh'])){
                                                                 //echo $this->Html->link(
                                                                //     $this->Html->image('../files/uploads/services/'.$value['Cateservice']['anh'],array("border"=>"0",'alt'=>$value['Cateservice']['name'],'width'=>114,'height'=>69)),
                                                                //     array('plugin'=>false,'language'=>$lang,'controller'=>"services","action"=>'index',$this->Link->seo($value['Cateservice']['id'],$value['Cateservice']['name'])),
                                                                //     array('class'=>'latestnews','escape'=>false)
                                                                // );?>
                                                                <?php // }else{?>
                                                                <?php //echo $this->Html->link(
                                                                //     $this->Html->image('no-image.png',array("border"=>"0",'alt'=>$value['Cateservice']['name'],'width'=>114,'height'=>69)),
                                                                //     array('plugin'=>false,'language'=>$lang,'controller'=>"services","action"=>'index',$this->Link->seo($value['Cateservice']['id'],$value['Cateservice']['name'])),
                                                                //     array('class'=>'latestnews','escape'=>false)
                                                                // ); }?>

                                                                    <div class='svcont'><?php echo $this->Text->truncate($value['Cateservice']['ghichu'],130,array('html'=>false,'exact' => false,'ending'=>' ...'));?></div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                <?php }?></div>
                                           <!--  </div>
                                        </div> -->
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- <div class="span6">
                <div class="module-color zt-mod-br">
                    <div class="zt-mod-bl">
                        <div class="zt-mod-tr">
                            <div class="zt-mod-tl clearfix">
                                <h3><span>
                                     <?php echo $this->Html->link(
                                           __('headerProduct',true),
                                            array('plugin'=>false,'language'=>$lang,'controller'=>"products","action"=>'index')
                                        );?>
                                </span></h3>
                                <div class="mod-content">
                                    <div id="scrollbar2" class='scolls'>
                                        <div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>
                                        <div class="viewport">
                                            <div class="overview span12">
                                                <?php foreach ($hProduct as $key => $value) {?>
                                                    <div class="latestnews" style="width:100%">
                                                        <div class="latestnewsitems" style="width:100%">
                                                            <div class="latestnewsitems-inner">
                                                                <?php if(is_file('files/uploads/products/'.$value['Cateproduct']['anh'])){?>
                                                                <?php echo $this->Html->link(
                                                                    $this->Html->image('../files/uploads/products/'.$value['Cateproduct']['anh'],array("border"=>"0",'alt'=>$value['Cateproduct']['name'],'width'=>114,'height'=>69)),
                                                                    array('plugin'=>false,'language'=>$lang,'controller'=>"products","action"=>'index',$this->Link->seo($value['Cateproduct']['id'],$value['Cateproduct']['name'])),
                                                                    array('class'=>'latestnews','escape'=>false)
                                                                );?>
                                                                <?php  }else{?>
                                                                <?php echo $this->Html->link(
                                                                    $this->Html->image('no-image.png',array("border"=>"0",'alt'=>$value['Cateproduct']['name'],'width'=>114,'height'=>69)),
                                                                    array('plugin'=>false,'language'=>$lang,'controller'=>"products","action"=>'index',$this->Link->seo($value['Cateproduct']['id'],$value['Cateproduct']['name'])),
                                                                    array('class'=>'latestnews','escape'=>false)
                                                                );?>
                                                                <?php }?>
                                                                <div>
                                                                    <h4>
                                                                        <?php echo $this->Html->link(
                                                                            $value['Cateproduct']['name'],
                                                                            array('plugin'=>false,'language'=>$lang,'controller'=>"products","action"=>'index',$this->Link->seo($value['Cateproduct']['id'],$value['Cateproduct']['name'])),
                                                                            array('class'=>'latestnews','escape'=>false)
                                                                        );?>
                                                                    </h4>

                                                                    <div><?php echo $this->Text->truncate($value['Cateproduct']['ghichu'],130,array('html'=>false,'exact' => false,'ending'=>' ...'));?></div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                <?php }?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div> -->
        </div>
    </div>
    <div id="zt-modwrap">
        <div class="zt-modwrap-pad">
            <div id="zt-colleft" class="span8">
                <div class="module-color zt-mod-br">
                    <div class="zt-mod-bl">
                        <div class="zt-mod-tr">
                            <div class="zt-mod-tl clearfix">
                                <h3><span><?php echo __('headerNews',true);?></span></h3>
                                <div class="mod-content">
                                    <div class="custom-color">
                                         <?php foreach ($hNews as $key => $value) {?>
                                         <div class="latestnews" style="width:100%">
                                                        <div class="latestnewsitems" style="width:100%">
                                                            <div class="latestnewsitems-inner">
                                            <?php if(is_file('files/uploads/news/'.$value['News']['image'])){?>
                                                    <?php echo $this->Html->link(
                                                        $this->Html->image('../files/uploads/news/'.$value['News']['image'],array("border"=>"0",'alt'=>$value['News']['title'],'width'=>114,'height'=>69)),
                                                        array('plugin'=>false,'language'=>$lang,'controller'=>"news","action"=>'chitiet',$this->Link->seo($value['News']['id'],$value['News']['title'])),
                                                        array('class'=>'latestnews','escape'=>false)
                                                    );?>
                                                    <?php  }else{?>
                                                    <?php echo $this->Html->link(
                                                        $this->Html->image('no-image.png',array("border"=>"0",'alt'=>$value['News']['title'],'width'=>114,'height'=>69)),
                                                        array('plugin'=>false,'language'=>$lang,'controller'=>"news","action"=>'chitiet',$this->Link->seo($value['News']['id'],$value['News']['title'])),
                                                        array('class'=>'latestnews','escape'=>false)
                                                    );?>
                                                    <?php }?>
                                            <div>
                                                <h4>
                                                    <?php echo $this->Html->link(
                                                        $value['News']['title'],
                                                        array('plugin'=>false,'language'=>$lang,'controller'=>"news","action"=>'chitiet',$this->Link->seo($value['News']['id'],$value['News']['title'])),
                                                        array('escape'=>false)
                                                    );?> <span style='font-weight: normal;'>(<?php echo  date('d/m',strtotime($value['News']['ngaydang']));?>)</span>
                                                </h4>
                                                    <?php echo $this->Text->truncate($value['News']['shortcontent'],250,array('ending'=>' ...','html'=>false,'exact'=>true));?>
                                            </div>

                                        </div></div></div>
                                        <?php }?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div id="guests" class="span4">
                <div class="module-color zt-mod-br">
                    <div class="zt-mod-bl">
                        <div class="zt-mod-tr">
                            <div class="zt-mod-tl clearfix">
                                <h3><span><?php echo $this->Html->link(__('headerPartner',true),array('plugin'=>false,'language'=>$lang,'controller'=>'guests','action'=>'index'));?></span></h3>
                                <div class="mod-content">


                                    <div class="custom-color">
                                        <marquee behavior="scroll" onmouseover='this.stop()' onmouseout='this.start()' hspace=0 direction="up" scrolldelay=50 scrollamount=1 loop=0>
                                             <?php foreach ($hPartner as $key => $value) {?>
                                                <div class="span6">
                                                    <a href="<?php echo $value['Guest']['url'];?>" target="_blank">
                                                                                                <?php echo
                                                        $this->Html->image('../files/uploads/guest/'.$value['Guest']['image'],array("border"=>"0",'alt'=>$value['Guest']['name'],"width"=>"108","height"=>"59",'class'=>'latestnews'));?>
                                                    </a>
                                                    <a href="<?php echo $value['Guest']['url'];?>" target="_blank">
                                            <?php echo $value['Guest']['name'];?> </a>
                                            </div>
                                            <?php }?>
                                        </marquee>
                                    </div>
                                </div>
                                <div class="clearfix"></div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <!--quang cao -->
        <div id="zt-modwrap">
            <div class="zt-modwrap-pad">
                <div id="zt-colleft" class="span12">
                    <div class="well">
                        <div id="myCarousel" class="carousel slide">
                        <!-- Carousel items -->
                        <div class="carousel-inner">
                         <?php
                             if (count($hBanners)%4==0) {
                                 $n= count($hBanners)/4;
                             }else $n = count($hBanners)/4 +1;
                             for($i=0;$i<$n-1;$i++){
                                $arr = array_slice($hBanners, ($i*4),4,true);
                                //debug($i);
                                //debug($arr);
                                ?>
                                <div <?php if($i==0){?>class="item active"<?php }else{?> class="item"<?php }?>>
                                    <div class="row-fluid">
                                        <?php foreach ($arr as $key => $value) {?>
                                        <div class="span3">
                                            <a target='_blank' href="<?php echo $value['Banner']['link'];?>" class='thumbnail'>
                                            <?php echo  $this->Html->image('../files/uploads/banners/'.$value['Banner']['image'],array("border"=>"0",'alt'=>$value['Banner']['name'],'style'=>'max-width:100%')
                                                                        );?>
                                                                    </a>
                                        </div>
                                      <?php }//endfor?>
                                    </div><!--/row-fluid-->
                                </div><!--/item-->
                            <?php
                            }
                         ?>
                        </div><!--/carousel-inner-->

                        <a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a>
                        <a class="right carousel-control" href="#myCarousel" data-slide="next">›</a>
                        </div><!--/myCarousel-->
                    </div><!--/well-->
                </div>
            </div>
        </div>
        <!--Het quang cao-->
    </div>